package org.huatek.anders.service;

import com.alibaba.dubbo.config.annotation.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author anders
 * @since 2018/11/15 21:03
 * FanoutExchange交换机
 */
@Slf4j
@Service
public class ApiReportSenderServiceImpl implements ApiReportSenderService {
    private final RabbitTemplate rabbitTemplate;
    @Autowired
    public ApiReportSenderServiceImpl(RabbitTemplate rabbitTemplate){
        this.rabbitTemplate = rabbitTemplate;
    }
    @Override
    public void generateReports(String msg){
        log.info("api.generate.reports send message: "+msg);
        rabbitTemplate.convertAndSend("reportExchange", "api.generate.reports", msg);
    }

}
